package _4_multithread._1_basic;


/**
 * Created by bpzj on 2019-02-14.
 */
public class ThreadImplRunnable implements Runnable {
    Integer integer = 0;

    @Override
    public void run() {
        synchronized (integer) {
            long time = System.currentTimeMillis();
            while (true) {
                integer += 1;
                if (System.currentTimeMillis() > time + 10000) {
                    break;
                }
            }
        }

    }

    private synchronized void syncMethod() {

    }

    public static synchronized void test() {
        System.out.println("static 方法使用的锁是 class对象");
    }

    public static void main(String[] args) {
        new Thread(new ThreadImplRunnable()).start();
    }
}
